import jieba
import os
from gensim.models import word2vec
from gensim.test.utils import get_tmpfile



def find_similar_words(model_path, word, topn=10):
    model = word2vec.Word2Vec.load(model_path)
    req_count = 10
    for key in model.wv.similar_by_word(word, topn=100):
        if len(key[0]) > 1:
            req_count -= 1
            print(key[0], key[1])
            if req_count == 0:
                break


def main():
    find_similar_words("word2vec.model", '段誉', topn=10)


if __name__ == '__main__':
    main()
